package com.example.demo.exception;

import com.example.demo.constant.ResponseCode;
import lombok.Data;

/**
 *@Description 业务异常
 *@Author Levi
 *@Date 2019/4/23-14:04
*/
@Data
public class DemoServiceException extends Exception {

    private int code;

    public DemoServiceException(int code, String message){
        super(message);
        this.code = code;
    }
    public DemoServiceException(ResponseCode responseCode){
        super(responseCode.getMsg());
        this.code = responseCode.getCode();
    }

    public DemoServiceException(ResponseCode responseCode, Throwable cause) {
        super(responseCode.getMsg(), cause);
        this.code = responseCode.getCode();
    }
}
